package cn.doitedu.dynamic_rule.functions;

import cn.doitedu.dynamic_rule.utils.Constants;
import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.streaming.connectors.kafka.FlinkKafkaConsumer;
import org.eclipse.jdt.internal.compiler.impl.Constant;

import java.util.Properties;

public class SourceFunctions {

    public static FlinkKafkaConsumer<String> getKafkaEventSource(){
       return  getKafkaEventSource("yinew_applog");
    }

    public static FlinkKafkaConsumer<String> getKafkaEventSource(String topic){

        Properties props = new Properties();
        props.setProperty("bootstrap.servers", "192.168.112.101:9092");
        props.setProperty("auto.offset.reset", "latest");
        FlinkKafkaConsumer<String> source = new FlinkKafkaConsumer<>(topic, new SimpleStringSchema(), props);


        return source;
    }



    public static FlinkKafkaConsumer<String> getKafkaRuleSource() {


        Properties props = new Properties();
        props.setProperty("bootstrap.servers", Constants.kafkaBootstrapServer);
        props.setProperty("auto.offset.reset", "latest");
        FlinkKafkaConsumer<String> source = new FlinkKafkaConsumer<>("yinew_drl_rule", new SimpleStringSchema(), props);


        return source;
    }
}
